package com.zhong.order.controller;

import com.zhong.order.feign.ProductFeignService;
import com.zhong.order.feign.StockFeignService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.client.RestTemplate;

@RestController
@RequestMapping("/order")
public class OrderController {

    @Autowired
    StockFeignService stockFeignService;
    @Autowired
    ProductFeignService productFeignService;

    @RequestMapping("/add")
    public String addOrder(){
        System.out.println("下单成功");
        String msg = stockFeignService.reduct();
        String id = productFeignService.get(1);
        System.out.println(msg);
        return "hello Order！" + msg + "===" + id;
    }

}
